package com.dragon.repository.domain.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import com.dragon.common.util.BeanUtils;
import com.dragon.repository.entity.Contract;
import com.dragon.repository.entity.Customer;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CustomerDTO {

    private static final long serialVersionUID = 1L;

    private Integer id;

    @ApiModelProperty(value = "客户名称")
    private String customerName;

    @ApiModelProperty(value = "用户id")
    private Integer adminId;

    @ApiModelProperty(value = "部门id")
    private Integer departmentId;

    @ApiModelProperty(value = "手机")
    private String phone;

    @ApiModelProperty(value = "删除标识：0未删除，1删除")
    private Integer deleted;

    @ApiModelProperty(value = "状态：0 待审核 1审核通过 2审核不通过 3作废 4删除")
    private Integer status;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "更改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date updateTime;

    @ApiModelProperty(value = "员工人数")
    private Integer numberofemployees;

    @ApiModelProperty(value = "公司性质")
    private String natureofbusiness;

    @ApiModelProperty(value = "客户类型")
    private Integer customertype;

    @ApiModelProperty(value = "客户行业：1.IT 2.金融业 3.房地产 4.商务服务 5.运输/物流 6.生产 7.政府 8.文化传媒")
    private Integer profession;

    @ApiModelProperty(value = "电话")
    private String telephone;

    @ApiModelProperty(value = "联系人")
    private String firstcontacter;


    @ApiModelProperty(value = "传真")
    private String fax;

    @ApiModelProperty(value = "Email")
    private String email;

    @ApiModelProperty(value = "地址")
    private String address;

    @ApiModelProperty(value = "支付方式：1银行转账 2微信 3支付宝 4现金 5支票")
    private Integer paymethod;

    @ApiModelProperty(value = "备注")
    private String memo;

    @ApiModelProperty(value = "技术联系人id")
    private Integer technicalId;

    @ApiModelProperty(value = "银行账号")
    private String bankAccount;

    @ApiModelProperty(value = "开户行名称")
    private String bankName;

    @ApiModelProperty(value = "申请人名称")
    private String applicantName;

    @ApiModelProperty(value = "法定代表人")
    private String legalAdmin;

    @ApiModelProperty(value = "结算方式：1现结，2月结")
    private Integer settlement;

    @ApiModelProperty(value = "合同成交量")
    private Integer numbers;

    @ApiModelProperty(value = "合同list")
    @TableField(exist = false)
    private List<Contract> contractList;



    public CustomerDTO() {}

    public CustomerDTO(Customer entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static CustomerDTO convert(Customer entity) {
        return new CustomerDTO(entity);
    }

    public static List<CustomerDTO> convertList(List<Customer> list) {
        List<CustomerDTO> resultList = new ArrayList<>();
        for (Customer entity : list) {
            resultList.add(new CustomerDTO(entity));
        }
        return resultList;
    }}
